using System;
using System.Collections.Generic;
using System.Text;
using NBusiness.Query;

namespace NBusiness.MySql.Query
{
    public class MySqlInnerJoin : IJoin
    {
        #region Member fields and properties
        private ITable _table;
        private IExpression _on;
        #endregion

        #region Constructors
        public MySqlInnerJoin() { }
        public MySqlInnerJoin(ITable table, IExpression on)
        {
            _table = table;
            _on = on;
        }
        #endregion

        #region IJoin Members

        public ITable Table
        {
            get { return _table; }
            set { _table = value; }
        }

        public IExpression On
        {
            get { return _on; }
            set { _on = value; }
        }

        #endregion

        #region IRelationalElement Members

        public string ToSql()
        {
            return "INNER JOIN " + _table.ToSql() + " ON " + _on.ToSql();
        }

        #endregion
    }
}
